<script setup lang="ts">
import { ref } from 'vue'
import MainMenu from '@/components/main-menu/main-menu.vue'
import MainHeader from '@/components/main-header/main-header.vue'

const isClosed = ref(false)

// 处理mainHeader折叠的变化
function handleHoldChange(isClose: boolean) {
  isClosed.value = isClose
}

</script>

<template>
  <div class="home">
    <el-container class="home-container">
      <el-aside :width="isClosed ? '60px' : '180px'">
        <MainMenu :isClose="isClosed" />
      </el-aside>
      <el-container>
        <el-header>
          <MainHeader @hold-change="handleHoldChange" />
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<style scoped>
.home {
  width: 100%;
  height: 100%;
}
.home-container {
  height: 100%;

  .el-aside {
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 200px;
    text-align: left;
    cursor: pointer;
    background-color: #001529;
    scrollbar-width: none;
    --ms-overflow-style: none;

    transition: width 0.5s ease;

    &::-webkit-scrollbar {
      display: none;
    }
  }
  .el-main {
    background-color: #f0f2f5;
  }
}
</style>
